package com.block.merge.sdk.manager;

import android.content.Context;
import android.util.Log;

import com.applovin.sdk.AppLovinMediationProvider;
import com.applovin.sdk.AppLovinPrivacySettings;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkConfiguration;
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
import com.block.merge.sdk.Constant;
import com.block.merge.sdk.ad.BlocklVideoIAP;
import com.block.merge.sdk.max.BlocklMaxReward;
import com.block.merge.sdk.utils.BlockAesUtils;

public class BlockVideoManger {

    public static void initMediation(Context context) {
        AppLovinPrivacySettings.setHasUserConsent(true);
        AppLovinPrivacySettings.setDoNotSell(false);

        AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(
                        BlockAesUtils.decrypt(Constant.MAX_KEY, Constant.REQUEST_HEADER_FLAG), context)
                .setMediationProvider(AppLovinMediationProvider.MAX)
                .build();
        // Initialize the SDK with the configuration
        AppLovinSdk.getInstance(context).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
            @Override
            public void onSdkInitialized(final AppLovinSdkConfiguration config) {
//                AppLovinSdk.getInstance(context).showMediationDebugger();
                Log.e("BloMerge", "onSdkInitialized");
                BlocklMaxReward.getInstance().loadAd();
            }
        });
    }

    public static BlocklVideoIAP getReward1Instance() {
        return BlocklMaxReward.getInstance();
    }
}
